package com.mayisoftware.mayioa.business.pool.api.domain;

import com.mayisoftware.mayioa.common.api.annotation.Excel;
import com.mayisoftware.mayioa.common.api.base.BaseEntity;
import liquibase.util.StringUtils;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 骨干池管理信息
 */
public class PoolMgrInfo extends BaseEntity {

    /**
     * 记录ID
     */
    private Integer poolRecordId;
    /**
     * 用户ID
     */
    @Excel(name = "用户序号")
    private Integer  poolUserId;

    /**
     * 计划ID
     */
    private Integer poolPlanId;

    /**
     * 是否骨干
     */
    @Excel(name = "是否骨干")
    private Integer poolIsBackbone;

    /**
     * 进入骨干池原因
     */
    @Excel(name = "进入骨干池原因")
    private String poolInDesc;

    /**
     * 出去骨干池原因
     */
    @Excel(name = "出去骨干池原因")
    private String poolOutDesc;

    /**
     * 总分数
     */
    @Excel(name = "总分数")
    private BigDecimal poolTotalScore;

    /**
     * 更新用户ID
     */
    private Integer poolUpdateUserId;

    /**
     * 更新日期
     */
    @Excel(name = "更新日期")
    private Date poolUpdateTime;

    /**
     * 成为骨干的方式
     */
    @Excel(name = "成为骨干的方式")
    private Integer poolCreateType;

    /**
     * 用户名
     */
    @Excel(name = "用户名")
    private String userName;

    /**
     * 部门ID
     */
    private String deptId;

    /**
     * 成为骨干时间
     */
    @Excel(name = "成为骨干时间")
    private Date poolInTime;

    /**
     * 剔除骨干时间
     */
    @Excel(name = "剔除骨干时间")
    private Date poolOutTime;

    /**
     * 部门名称
     */
    @Excel(name = "部门名称")
    private String deptName;

    /**
     * 计划名称
     */
    @Excel(name = "计划名称")
    private String planName;

    /**
     * 剔除骨干方式
     */
    @Excel(name = "剔除骨干方式")
    private Integer poolDeleteType;

    /**
     * 分数状态信息
     */
    private Integer poolScoreStatus;

    /**
     * 分数的版本状态
     */
    private Long poolScoreVersion;

    /**
     * 计划排名
     */
    private Integer poolPlanRank;

    /**
     * 倒数N名
     */
    private Integer poolPlanLastn;

    public Long getPoolScoreVersion() {
        return poolScoreVersion;
    }

    public void setPoolScoreVersion(Long poolScoreVersion) {
        this.poolScoreVersion = poolScoreVersion;
    }

    public Integer getPoolScoreStatus() {
        return poolScoreStatus;
    }

    public void setPoolScoreStatus(Integer poolScoreStatus) {
        this.poolScoreStatus = poolScoreStatus;
    }

    public Integer getPoolRecordId() {
        return poolRecordId;
    }

    public void setPoolRecordId(Integer poolRecordId) {
        this.poolRecordId = poolRecordId;
    }

    public Integer getPoolUserId() {
        return poolUserId;
    }

    public void setPoolUserId(Integer poolUserId) {
        this.poolUserId = poolUserId;
    }

    public Integer getPoolPlanId() {
        return poolPlanId;
    }

    public void setPoolPlanId(Integer poolPlanId) {
        this.poolPlanId = poolPlanId;
    }

    public Integer getPoolIsBackbone() {
        return poolIsBackbone;
    }

    public void setPoolIsBackbone(Integer poolIsBackbone) {
        this.poolIsBackbone = poolIsBackbone;
    }

    public String getPoolInDesc() {
        return poolInDesc;
    }

    public void setPoolInDesc(String poolInDesc) {
        this.poolInDesc = poolInDesc;
    }

    public String getPoolOutDesc() {
        return poolOutDesc;
    }

    public void setPoolOutDesc(String poolOutDesc) {
        this.poolOutDesc = poolOutDesc;
    }

    public BigDecimal getPoolTotalScore() {
        return poolTotalScore;
    }

    public void setPoolTotalScore(BigDecimal poolTotalScore) {
        this.poolTotalScore = poolTotalScore;
    }

    public Integer getPoolUpdateUserId() {
        return poolUpdateUserId;
    }

    public void setPoolUpdateUserId(Integer poolUpdateUserId) {
        this.poolUpdateUserId = poolUpdateUserId;
    }

    public Date getPoolUpdateTime() {
        return poolUpdateTime;
    }

    public void setPoolUpdateTime(Date poolUpdateTime) {
        this.poolUpdateTime = poolUpdateTime;
    }

    public Integer getPoolCreateType() {
        return poolCreateType;
    }

    public void setPoolCreateType(Integer poolCreateType) {
        this.poolCreateType = poolCreateType;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public Date getPoolInTime() {
        return poolInTime;
    }

    public void setPoolInTime(Date poolInTime) {
        this.poolInTime = poolInTime;
    }

    public Date getPoolOutTime() {
        return poolOutTime;
    }

    public void setPoolOutTime(Date poolOutTime) {
        this.poolOutTime = poolOutTime;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getPlanName() {
        return planName;
    }

    public void setPlanName(String planName) {
        this.planName = planName;
    }

    public Integer getPoolDeleteType() {
        return poolDeleteType;
    }

    public void setPoolDeleteType(Integer poolDeleteType) {
        this.poolDeleteType = poolDeleteType;
    }

    public Integer getPoolPlanRank() {
        return poolPlanRank;
    }

    public void setPoolPlanRank(Integer poolPlanRank) {
        this.poolPlanRank = poolPlanRank;
    }

    public Integer getPoolPlanLastn() {
        return poolPlanLastn;
    }

    public void setPoolPlanLastn(Integer poolPlanLastn) {
        this.poolPlanLastn = poolPlanLastn;
    }

    public void setPoolPlanLastn(boolean isLastN){
        if(isLastN){
            setPoolPlanLastn(1);
        }else{
            setPoolPlanLastn(0);
        }
    }

    public void setPoolPlanRankInfo(Integer rank, Integer totalRank, String lastN){
        if(rank == null || totalRank == null || StringUtils.isEmpty(lastN)){
            return;
        }
        setPoolPlanRank(rank);
        boolean isLastN = (totalRank - rank + 1) <= Integer.parseInt(lastN);
        setPoolPlanLastn(isLastN);
    }
}
